package com.yanqu.road.entity.activity.ghost;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_u_activity_ghost_user_data")
public class GhostUserData extends DataObject {

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "用户ID", select = true, update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "体力")
    private int energy;
    @FieldTypeAnnotation(desc = "体力恢复时间")
    private long lastRecoveryTime;
    @FieldTypeAnnotation(desc = "事件类型")
    private int eventType;
    // boss事件：bossId|boss类型
    // 货箱事件：货箱Id|宝箱道具id
    // 闷包事件：真奖励|假奖励
    @FieldTypeAnnotation(desc = "事件参数")
    private String param;
    @FieldTypeAnnotation(desc = "是否完成")
    private boolean complete;
    @FieldTypeAnnotation(desc = "事件时间")
    private long eventTime;
    @FieldTypeAnnotation(desc = "是否领取送财奖励")
    private boolean getDisperse;
    @FieldTypeAnnotation(desc = "buff等级")
    private int buffLevel;
    @FieldTypeAnnotation(desc = "积分")
    private long score;
    @FieldTypeAnnotation(desc = "鬼市信物")
    private int tokenCount;
    @FieldTypeAnnotation(desc = "门客攻击次数")
    private Map<Integer, GhostPatrons> attackMap = new ConcurrentHashMap<>();
    @FieldTypeAnnotation(desc = "每日重置时间")
    private long resetTime;
    @FieldTypeAnnotation(desc = "今日购买体力次数")
    private int buyEnergyTimes;
    @FieldTypeAnnotation(desc = "是否领取boss全清送财奖励")
    private boolean getCleanDisperse;
    @FieldTypeAnnotation(desc = "未探索到活阎王次数")
    private int exploreTimes;

    private int preReduceEnergy; // 预扣除体力
    private long lastExploreTime; // 上次探索请求时间
    private long lastAttackTime;  // 上次攻击时间

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setUpdateOption();
        }
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setUpdateOption();
        }
    }

    public void setEnergy(int energy) {
        if (this.energy != energy) {
            this.energy = energy;
            setUpdateOption();
        }
    }

    public void setLastRecoveryTime(long lastRecoveryTime) {
        if (this.lastRecoveryTime != lastRecoveryTime) {
            this.lastRecoveryTime = lastRecoveryTime;
            setUpdateOption();
        }
    }

    public void setComplete(boolean complete) {
        if (this.complete != complete) {
            this.complete = complete;
            setUpdateOption();
        }
    }

    public void setGetDisperse(boolean getDisperse) {
        if (this.getDisperse != getDisperse) {
            this.getDisperse = getDisperse;
            setUpdateOption();
        }
    }

    public void setBuffLevel(int buffLevel) {
        if (this.buffLevel != buffLevel) {
            this.buffLevel = buffLevel;
            setUpdateOption();
        }
    }

    public void setScore(long score) {
        if (this.score != score) {
            this.score = score;
            setUpdateOption();
        }
    }

    public void setTokenCount(int tokenCount) {
        if (this.tokenCount != tokenCount) {
            this.tokenCount = tokenCount;
            setUpdateOption();
        }
    }

    public void setAttackMap(Map<Integer, GhostPatrons> attackMap) {
        this.attackMap = attackMap;
        setUpdateOption();
    }

    public void setResetTime(long resetTime) {
        if (this.resetTime != resetTime) {
            this.resetTime = resetTime;
            setUpdateOption();
        }
    }

    public void setEvent(int eventType, String eventParam, long eventTime) {
        this.eventType = eventType;
        this.param = eventParam;
        this.eventTime = eventTime;
        setUpdateOption();
    }

    public void setBuyEnergyTimes(int buyEnergyTimes) {
        if (this.buyEnergyTimes != buyEnergyTimes) {
            this.buyEnergyTimes = buyEnergyTimes;
            setUpdateOption();
        }
    }

    public void setGetCleanDisperse(boolean getCleanDisperse) {
        if (this.getCleanDisperse != getCleanDisperse) {
            this.getCleanDisperse = getCleanDisperse;
            setUpdateOption();
        }
    }

    public void setExploreTimes(int exploreTimes) {
        if (this.exploreTimes != exploreTimes) {
            this.exploreTimes = exploreTimes;
            setUpdateOption();
        }
    }

    // ======================================


    public boolean isGetCleanDisperse() {
        return getCleanDisperse;
    }

    public int getBuyEnergyTimes() {
        return buyEnergyTimes;
    }

    public void setPreReduceEnergy(int preReduceEnergy) {
        this.preReduceEnergy = preReduceEnergy;
    }

    public void setLastExploreTime(long lastExploreTime) {
        this.lastExploreTime = lastExploreTime;
    }

    public void setLastAttackTime(long lastAttackTime) {
        this.lastAttackTime = lastAttackTime;
    }

    public int getActivityId() {
        return activityId;
    }

    public long getUserId() {
        return userId;
    }

    public int getEnergy() {
        return energy;
    }

    public long getLastRecoveryTime() {
        return lastRecoveryTime;
    }

    public int getEventType() {
        return eventType;
    }

    public String getParam() {
        return param;
    }

    public boolean isComplete() {
        return complete;
    }

    public long getEventTime() {
        return eventTime;
    }

    public boolean isGetDisperse() {
        return getDisperse;
    }

    public int getBuffLevel() {
        return buffLevel;
    }

    public long getScore() {
        return score;
    }

    public int getTokenCount() {
        return tokenCount;
    }

    public Map<Integer, GhostPatrons> getAttackMap() {
        return attackMap;
    }

    public long getResetTime() {
        return resetTime;
    }

    public int getPreReduceEnergy() {
        return preReduceEnergy;
    }

    public long getLastExploreTime() {
        return lastExploreTime;
    }

    public long getLastAttackTime() {
        return lastAttackTime;
    }

    public int getExploreTimes() {
        return exploreTimes;
    }
}
